package com.surfilter.platform.base.util;

import java.util.HashMap;
import java.util.Map;
import java.util.Properties;

import org.springframework.beans.BeansException;
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
import org.springframework.beans.factory.config.PropertyPlaceholderConfigurer;

public class PropertyHolder extends PropertyPlaceholderConfigurer {
	
	private static Map<String,String> contextProperties = new HashMap<String,String>();

	@Override
	protected void processProperties(
			ConfigurableListableBeanFactory beanFactoryToProcess,
			Properties props) throws BeansException {
		super.processProperties(beanFactoryToProcess, props);
		for (Object key : props.keySet()) {  
            String keyStr = key.toString();  
            String value = props.getProperty(keyStr);  
            contextProperties.put(keyStr, value);  
        }  
	}
	
	public static String getValue(String key){
		if(key != null){
			return contextProperties.get(key);
		}
		return null;
	}
	
	
	
}
